# -*- coding: utf-8 -*- 
from django.db import models

class Country(models.Model):
    name = models.CharField(u'Nazwa kraju',maxlength=20,unique=True,help_text=u'Nazwa kraju w języku polskim.')
    countrycode = models.CharField(u'Kod kraju',maxlength=5,null=True,blank=True,help_text=u'Kod kraju, np. PL, DE.') # PL DE
    class Meta:
        ordering = ['name']
        verbose_name = u'Kraj'
        verbose_name_plural = u'Kraje'
    def __unicode__(self):
        return self.name
    class Admin:
        pass  


class City(models.Model):
    name = models.CharField(maxlength=20, help_text=u'Nazwa miasta.')
    country = models.ForeignKey(Country,help_text=u'Kraj, należy wybrać z listy.') 
    class Meta:
        ordering = ['country','name']
        unique_together = (('name', 'country'),)
        verbose_name = u'miasto'
        verbose_name_plural = u'miasta'
    def __unicode__(self):
        return self.name
    class Admin:
        pass  
        
  